
/*
*Released on 28th June 2008.
*Any violations can be reported at paritosh@wikiocean.net
*What is treated as violations can be found at www.wikiocean.net/ppl1-voilations*
******************************************************************************
* The contents of this file are subject to POOL Public License 1.0 and later.
* POOL Public License is based on Affero GPL v3 and additional conditions.
* ("License"); You may not use this file except in compliance with the License
* You may obtain a copy of the Affero GPL v3 License at http://www.gnu.org/licenses/agpl.html
* You may obtain a copy of the POOL Public License 1.0 or later at www.wikiocean.net/license/ppl.html
* Software distributed under POOL Public License 1.0 is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
* the specific language governing rights and limitations under the License.
* The Initial Developer of the Original Code is Paritosh Pungaliya (C) 2008. All Rights Reserved.
******************************************************************************
* Objective of the additional terms (license)
* 1) Is to extend the software freedom to freedom to work.
* 2) To ensure that knowledge is free from monopoly of agencies.
* 3) To avoid a situation where big corporate or investor can buy out free software groups and companies and then start milking the communities built around it.
* (this trend can be seen how the freedom is curtailed in companies that get Venture Capital funding.)
******************************************************************************
*/

package  utility;

import java.io.FileInputStream;
import java.util.Properties;

public class Input 
{
	public static String DB_USERNAME;
	public static String DB_PASSWORD;
	public static String DB_PREFIX;
	public static String DB_NAME;
	public static String DB_HOST;
	public static String DB_DRIVER;
		
	public static boolean LOGGER_INFO = false;
	public static boolean LOGGER_WARN = false;
	public static boolean LOGGER_FATAL = false;
	public static boolean LOGGER_ERROR = false;
	public static boolean LOGGER_DEBUG = false;
	public static boolean LOGGER_TRACE = false;
	
	public static boolean FILE_APPENDER = false;
	public static boolean CONSOLE_APPENDER = true;
	
	public static String TYPE;
	public static String ROOT;
	public static String MASTERREPORTSPATH;
	public static String TRASACTIONREPORTSPATH;
	public static String BASICREPORTSPATH;
	public static String BASICTRANSDETAILSREPORTPATH;
	public static String CUSTOMREPORTS;
	
	public static String PROCESSLOGGERPATH;
	public static String LogDir;
	public static String STORAGEPATH;
	public static String BILLREPORT;
	public static String SOBILLREPORT;
	public static String SENDMESSAGELOG;
	public static String SMSBUFFER;
	public static String TDPRODETAILSREPORT;
	public static String GROUPREPORT;
	public static String TRANSPDREPORT;

	public static String SEPARATOR ="\t";
	public static String ENDSEPARATOR="\n";
	
	public static String FILRFORMAT=".txt";
	
	public static String LOCATION;
	public static String URL;
	public static String WEB_REPORTS_FILES;

	public static String DATEFIELD="FROM_DATE";
	public static String HTMLINPUT;
	public static String COMMANDOUTPUT;
	public static String DISPLAYTEXT_FILES;
    public static String TIMER_DIR;
    public static String CONVERSIONPATTERN = "";
    
    public static int INITIALCONNECTIONS ;
    public static int MAXCONNECTIONS;
	public static String WEBREPLACER;
    
    static
    {
    	//String path = System.getProperty("user.dir") + "//pool.properties";
    	String path = "//home//ubuntu//workspace//FinalPOOL 0.1.2//pool.properties";
    	
    	Properties prop = new Properties();
    	try
    	{
    		//System.out.println("Reading Properties");
    		prop.load(new FileInputStream(path));
    		//System.out.println(prop);
    		DB_USERNAME = prop.getProperty("DB_USERNAME");
    		DB_PASSWORD = prop.getProperty("DB_PASSWORD");
    		DB_PREFIX = prop.getProperty("DB_PREFIX");
    		DB_NAME = prop.getProperty("DB_NAME");
    		DB_HOST = prop.getProperty("DB_HOST");
    		DB_DRIVER = prop.getProperty("DB_DRIVER");;

    		TYPE = prop.getProperty("TYPE");
    		ROOT = prop.getProperty("ROOT");
    		MASTERREPORTSPATH = ROOT + "//" + prop.getProperty("MASTERREPORTSPATH");
			TRASACTIONREPORTSPATH = ROOT + "//" + prop.getProperty("TRASACTIONREPORTSPATH");
			BASICREPORTSPATH = ROOT + "//" + prop.getProperty("BASICREPORTSPATH");
			BASICTRANSDETAILSREPORTPATH = ROOT + "//" + prop.getProperty("BASICTRANSDETAILSREPORTPATH");
			CUSTOMREPORTS = ROOT + "//" + prop.getProperty("CUSTOMREPORTS");
			PROCESSLOGGERPATH = ROOT + "//" + prop.getProperty("PROCESSLOGGERPATH");
			LogDir = ROOT + prop.getProperty("LogDir");
			STORAGEPATH = ROOT + "//" + prop.getProperty("STORAGEPATH");
			BILLREPORT= ROOT + "//" + prop.getProperty("BILLREPORT");
			SOBILLREPORT= ROOT + "//" + prop.getProperty("SOBILLREPORT");
			SENDMESSAGELOG = ROOT + "//" + prop.getProperty("SENDMESSAGELOG");
			SMSBUFFER = ROOT + "//" + prop.getProperty("SMSBUFFER");
			TDPRODETAILSREPORT = ROOT + "//" + prop.getProperty("TDPRODETAILSREPORT");
			GROUPREPORT=ROOT+prop.getProperty("GROUPREPORT");
			TRANSPDREPORT=ROOT+prop.getProperty("TRANSPDREPORT");
			SEPARATOR = prop.getProperty("SEPARATOR");;
			ENDSEPARATOR= prop.getProperty("ENDSEPARATOR");
	
			FILRFORMAT=prop.getProperty("FILRFORMAT");
			LOCATION = prop.getProperty("LOCATION");
			URL = prop.getProperty("URL");
			WEB_REPORTS_FILES = ROOT + prop.getProperty("WEB_REPORTS_FILES");
			DATEFIELD = prop.getProperty("DATEFIELD");
			HTMLINPUT = ROOT + "//" + prop.getProperty("HTMLINPUT");
			COMMANDOUTPUT = ROOT + "//" + prop.getProperty("COMMANDOUTPUT");
			DISPLAYTEXT_FILES = ROOT + "//" + prop.getProperty("DISPLAYTEXT_FILES");
			TIMER_DIR = ROOT + "//" +prop.getProperty("TIMER_DIR");
			CONVERSIONPATTERN = prop.getProperty("ConversionPattern");
			WEBREPLACER = prop.getProperty("WEBREPLACER");
			
			INITIALCONNECTIONS = Integer.parseInt(prop.getProperty("INITIALCONNECTIONS"));
	   		MAXCONNECTIONS = Integer.parseInt(prop.getProperty("MAXCONNECTIONS"));
	   		
	   		LOGGER_WARN = Boolean.parseBoolean("LOGGER_WARN");
	   		LOGGER_FATAL = Boolean.parseBoolean("LOGGER_FATAL");
	   		LOGGER_ERROR = Boolean.parseBoolean("LOGGER_ERROR");
	   		LOGGER_DEBUG = Boolean.parseBoolean("LOGGER_DEBUG");
	   		LOGGER_TRACE = Boolean.parseBoolean("LOGGER_TRACE");
	   			
	   		FILE_APPENDER = Boolean.parseBoolean("FILE_APPENDER");
	   		CONSOLE_APPENDER = Boolean.parseBoolean("CONSOLE_APPENDER");
	   }
    	catch (Exception e) {
    		e.printStackTrace();
		}
    }
    
    public static void initialize()
    {

    	String path = "//home//ubuntu//workspace//FinalPOOL 0.1.2//pool.properties";
    	Properties prop = new Properties();
    	try
    	{
    		System.out.println("Reading Properties");
    		prop.load(new FileInputStream(path));
    		System.out.println(prop);
    		INITIALCONNECTIONS = Integer.parseInt(prop.getProperty("INITIALCONNECTIONS"));
    		MAXCONNECTIONS = Integer.parseInt(prop.getProperty("MAXCONNECTIONS"));
    	}
    	catch (Exception e) {
			// TODO: handle exception
		}
    }
    
    public static void main(String[] args) {
		//Input.init(); 
	}
}
